package cn.myjerry.io.file;

import java.io.File;

/**
 * 相对路径与绝对路径构造File对象
 * 1、相对路径
 * 2、绝对路径
 * @author Jerry
 *
 */
public class Demo02 {
	public static void main(String[] args) {
		String pathname = "/Users/zpon/Desktop/赞购";
		String name = "app-release.apk";
		// 相对路径
		System.out.println("===========相对路径===========");
		File src = new File(pathname, name);
		src = new File(new File(pathname), name);
		// 输出
		System.out.println(src.getPath());
		System.out.println(src.getName());
		// 绝对路径
		System.out.println("===========绝对路径===========");
		src = new File("/Users/zpon/Desktop/赞购/app-release.apk");
		System.out.println(src.getPath());
		System.out.println(src.getName());
		// 没有盘符: 以user.dir构建
		System.out.println("===========没有盘符===========");
		src = new File("app-release.apk");
		src = new File(".");
		System.out.println(src.getPath());
		System.out.println(src.getName());
		System.out.println(src.getAbsolutePath());
	}
}
